package com.ifinc.common.example;

import com.ifinc.common.web.controller.CentralControler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * TODO 添加注释
 *
 * @author luotao
 * @version 1.0 2013-06-09
 */

public class Html5Servlet extends HttpServlet {

    static final Logger log = LoggerFactory.getLogger(Html5Servlet.class);

    CentralControler centralControler = new CentralControler();

    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }

    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        log.info("enter doGet!!!");
        String command = req.getParameter("command");
        String result = centralControler.execute(req,resp,command);

        resp.sendRedirect("/test/redirect.jsp");
        req.getRequestDispatcher(result).forward(req,resp);
     /*   PrintWriter out = resp.getWriter();
        out.print("OK");
        out.flush();
        out.close();*/
    }
}
